/**
 *  Copyright 2009-2010 Steven Ottenhoff (Dual-IT)
 * 
 *  This file is part of Clazzified.
 *
 *  Clazzified is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Clazzified is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Clazzified.  If not, see http://www.gnu.org/licenses/gpl.
 * 
 */

package nl.dualit.clazzified.core.model.attribute;

/**
 * Defines the various types an attribute can have. If the type is clazz
 * a constraint must be provided representing the clazz id. The object value must point
 * to a existing object of the same type of the clazz id.
 * 
 * @author Steven Ottenhoff
 *
 */
public enum AttributeTypes {

	INTEGER ( "integer", "Attribute is a negative or positive number e.g. ( -100, -8, 0, 2, 15 )" ),
	FLOAT( "float", "Attribute is a negative or positive fragmented number" ),
	TEXT( "text", "Attribute is an alphanumeric text" ),
	CURRENCY( "currency", "Attribute is a currency" ),
	CLAZZ( "clazz", "Attribute is a reference to an existing clazz" ),
	IMAGE( "image", "Attribute is an image of type jpeg, png or gif" );
	
	private final String typeName;
	private final String description;
	
	AttributeTypes( String typeName, String description ){
	
		this.typeName = typeName;
		this.description = description;
	
	}
	
	public String typeName() { return typeName; }
	public String description() { return description; }
	
	public static AttributeTypes getType( String typeName ){
		
		for( AttributeTypes type : AttributeTypes.values() )
			if( type.typeName().equals( typeName ) )
				return type;
		
		return null;
	}
}
